Beispiel #1
0
 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
     $media = json_decode(file_get_contents(dir::addon('mediamanager', 'config.json')), true);
     // Wenn die Datei eine "verbotene" Datei ist
     if (in_array($extension, $media['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;
 }
Beispiel #2
0
 public static function getConfig($name)
 {
     $configFile = dir::addon($name, 'config.json');
     if (file_exists($configFile)) {
         return json_decode(file_get_contents($configFile), true);
     }
     return false;
 }
Beispiel #3
0
 public static function saveConfig($from, $fromName, $confirmReading, $bbc)
 {
     $config = dyn::get('addons')['phpmailer'];
     $config['settings']['from'] = $from;
     $config['settings']['fromName'] = $fromName;
     $config['settings']['confirmReading'] = $confirmReading;
     $config['settings']['bbc'] = $bbc;
     return file_put_contents(dir::addon('phpmailer', 'config.json'), json_encode($config, JSON_PRETTY_PRINT));
 }
 public static function sendLostPasswordMail($email)
 {
     $sql = sql::factory();
     $sql->query('SELECT id FROM ' . sql::table('community_user') . ' WHERE `email` = ' . $sql->escape($email));
     if (!$sql->num()) {
         return 'Keinen User mit der E-Mail-Adresse vorhanden';
     }
     $content = file_get_contents(dir::addon('community', 'lostpasswordemail.txt'));
     $key = self::generateString(16);
     $url = dyn::get('hp_url') . 'index.php?lostpassword='******'{{url}}', $url, $content);
     // Mailsend
     $sql->setTable('community_user');
     $sql->setWhere('id=' . $sql->get('id'));
     $sql->addPost('lostpw_key', $key);
     $sql->update();
 }
Beispiel #5
0
 public static function generatePathlist()
 {
     $return = [];
     $sql = sql::factory();
     $sql->query('SELECT name, id, seo_costum_url, parent_id FROM ' . sql::table('structure'))->result();
     while ($sql->isNext()) {
         if ($sql->get('seo_costum_url')) {
             $name = $sql->get('seo_costum_url');
         } else {
             $name = self::makeSEOName($sql->get('name'));
         }
         if ($sql->get('parent_id')) {
             $name = self::getParentsName($sql->get('parent_id')) . '/' . $name;
         }
         $return[$name] = $sql->get('id');
         $sql->next();
     }
     return file_put_contents(dir::addon('seo', 'pathlist.json'), json_encode($return, JSON_PRETTY_PRINT));
 }
Beispiel #6
0
 public static function generatePathlist()
 {
     $return = [];
     $sql = sql::factory();
     $sql->query('SELECT name, id, seo_costum_url, parent_id FROM ' . sql::table('structure'))->result();
     while ($sql->isNext()) {
         if ($sql->get('seo_costum_url')) {
             $name = $sql->get('seo_costum_url');
         } else {
             $name = self::makeSEOName($sql->get('name'));
         }
         if ($sql->get('parent_id')) {
             $name = self::getParentsName($sql->get('parent_id')) . '/' . $name;
         }
         if ($sql->get('id') == dyn::get('start_page') && dyn::get('addons')['seo']['start_url'] == 0) {
             $name = '';
         }
         $return[$name] = (int) $sql->get('id');
         $sql->next();
     }
     $return = extension::get('SEO_GENERATE_PATHLIST', $return);
     return file_put_contents(dir::addon('seo', 'pathlist.json'), json_encode($return, JSON_PRETTY_PRINT));
 }
Beispiel #7
0
    if ($seoFunc == 'robots') {
        $robots = new seo_robots();
        $robots->send();
        die;
    }
    if ($seoFunc == 'sitemap') {
        $sitemap = new seo_sitemap();
        $sitemap->setArticles(dyn::get('addons')['seo']['sitemap']['offlines']);
        $sitemap->send();
        die;
    }
} else {
    userPerm::add('admin[seo]', 'SEO Administrator');
    seo_control::addToPathlist('default', seo_control::getUrlsFromTable('addons', ['id', 'name']));
    backend::addAddonNavi(lang::get('seo'), url::backend('seo'), 'flag', -1, function () {
        return dir::addon('seo', 'page' . DIRECTORY_SEPARATOR . 'seo.php');
    });
    seo::setPageId(dyn::get('start_page'));
    $page = type::super('page', 'string');
    $subpage = type::super('subpage', 'string');
    $action = type::super('action', 'string');
    $structure_id = type::super('structure_id', 'int', 0);
    $id = type::super('id', 'int', 0);
    // Falls was an der Page geändert worden ist
    if ($page == 'structure' && $subpage == 'pages' && in_array($action, ['add', 'edit', 'seo']) && !$structure_id) {
        extension::add('FORM_AFTER_SAVE', function ($sql) {
            seo_rewrite::generatePathlist();
            return $sql;
        });
    }
    // Wenn SEO Button geklickt worden ist
Beispiel #8
0
<?php

backend::addAddonNavi(lang::get('imexport'), url::backend('import'), 'circle', -1, function () {
    return dir::addon('imexport', 'page' . DIRECTORY_SEPARATOR . 'import.php');
});
Beispiel #9
0
                        <?php 
    }
    ?>
						<a href="<?php 
    echo url::backend('addons', ['subpage' => 'overview']);
    ?>
" class="btn btn-sm btn-default"><?php 
    echo lang::get('back');
    ?>
</a>
					</div>
					<div class="clearfix"></div>
				</div>
                <div class="panel-body">              
					<?php 
    $file = dir::addon($addon, 'README.md');
    if (file_exists($file)) {
        echo markdown::parse(file_get_contents($file));
    } else {
        echo lang::get('addon_no_readme');
    }
    ?>
                </div>
			</div>
		</div>
	</div>
<?php 
} else {
    $table = table::factory();
    $table->addCollsLayout('20,*,215');
    $table->addRow()->addCell('')->addCell(lang::get('name'))->addCell(lang::get('actions'));
Beispiel #10
0
<?php

$sql = sql::factory();
$sql->query('ALTER TABLE ' . sql::table('structure') . ' 
ADD `seo_title` 		VARCHAR(255) NOT NULL,
ADD `seo_keywords` 		VARCHAR(255) NOT NULL,
ADD `seo_description`	VARCHAR(255) NOT NULL,
ADD `seo_costum_url` 	VARCHAR(255) NOT NULL,
ADD `seo_robots` 		int(1)		 NOT NULL DEFAULT "1"
');
copy(dir::addon('seo', '_htaccess'), dir::base('.htaccess'));
include_once dir::addon('seo', 'lib' . DIRECTORY_SEPARATOR . 'seo_rewrite.php');
seo_rewrite::generatePathlist();
Beispiel #11
0
	<div class="col-md-6">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title"><?php 
echo lang::get('htacces_install');
?>
</h3>
			</div>
			<div class="panel-body">
				<?php 
$form = form::factory('user', 'id=' . dyn::get('user')->get('id'), 'index.php');
$form->setSave(false);
$form->delButton('back');
$form->delButton('save');
$htaccessRoot = dir::base('.htaccess');
$htaccessOrg = dir::addon('seo', '_htaccess');
$field = $form->addRadioField('redirect', 'www');
$field->fieldName(lang::get('seo_redirect_to'));
$field->add('www', 'www.');
$field->add('no_www', lang::get('seo_no_www'));
$urlPath = parse_url(dyn::get('hp_url'));
$subdir = '/';
if (isset($urlPath['path'])) {
    $subdir = trim($urlPath['path'], '/');
}
if ($subdir == '') {
    $subdir = '/';
}
$field = $form->addTextField('rewrite_base', $subdir);
$field->addAttribute('readonly', 'readonly');
$field->fieldName('Rewrite Base');
Beispiel #12
0
<?php

if (!dyn::get('backend')) {
    if (!is_null(type::post('community_login', 'string'))) {
        community_user::checkLogin();
    } else {
        community_user::checkSession();
    }
} else {
    userPerm::add('coummunity[]', 'Community Administrator');
    backend::addAddonNavi(lang::get('community'), url::backend('community'), 'group', -1, function () {
        return dir::addon('community', 'page' . DIRECTORY_SEPARATOR . 'community.php');
    });
}
Beispiel #13
0
 public function delete()
 {
     $this->uninstall();
     $sql = sql::factory();
     $sql->setTable('addons')->setWhere('`name` = "' . $this->name . '"')->delete();
     unlink(dir::addon($this->name));
     return message::success(sprintf(lang::get('addon_deleted'), $this->name));
 }
Beispiel #14
0
 public static function getSubnaviInclude($addon = false)
 {
     self::setCurrents();
     $page = self::$getVars[0];
     $subpage = self::$getVars[1];
     $current = self::$subnavi[self::getSubpageName()];
     // isset gibts bei null false aus
     if (isset($current['callback']) && is_callable($current['callback'])) {
         return $current['callback']();
     }
     if (!$addon) {
         return dir::page($page . '.' . $subpage . '.php');
     } else {
         return dir::addon($addon, 'page/' . $page . '.' . $subpage . '.php');
     }
 }
Beispiel #15
0
 public function isImage()
 {
     $media = json_decode(file_get_contents(dir::addon('mediamanager', 'config.json')), true);
     return in_array($this->getExtension(), $media['extensions']['image']);
 }
Beispiel #16
0
<?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');
    });
}
Beispiel #17
0
<?php

if (dyn::get('backend')) {
    backend::addAddonNavi(lang::get('phpmailer'), url::backend('phpmailer'), 'envelope', 0, function () {
        return dir::addon('phpmailer', 'page' . DIRECTORY_SEPARATOR . 'phpmailer.php');
    });
}
Beispiel #18
0
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');
        });
    }
}
Beispiel #19
0
 public function delete()
 {
     $this->uninstall();
     $sql = new sql();
     $sql->setTable('addons')->setWhere('`name` = "' . $this->name . '"')->delete();
     $dir = dir::addon($this->name);
     $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
     $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
     foreach ($files as $file) {
         if ($file->getFilename() === '.' || $file->getFilename() === '..') {
             continue;
         }
         if ($file->isDir()) {
             rmdir($file->getRealPath());
         } else {
             unlink($file->getRealPath());
         }
     }
     rmdir($dir);
     return message::success(sprintf(lang::get('addon_deleted'), $this->name));
 }